package LanQiaoCompetition.LanQiaoCompetition2;

public class RealyTest {

    public static double []numbers = new double[]{1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0};
    private static int result = 0;
    static int []loc = new int[5];

    public static void main(String args[]){
        //one(100);
        //two(236);
        //three(0);
        //System.out.println((char)(1+'A'));
        seven();
        System.out.println(result);
        int[] a = new int[]{0,0,0,0,0};
        System.out.println(String.valueOf(a));
    }

    public static void one(int n){
        int result=0;
        int a = 0;
        for(int i=1;i<=n;i++){
            result = result + i;
            a = a+result;
        }
        System.out.print(a);
    }

    public static void two(int n){
        int result = 0;
        for(int j=1;j<=100;j++){
            for(int k=j;result<n;k++){
                result = result+k;
                if(result == n){
                    System.out.println(j);
                    return;
                }
            }
            result = 0;
        }
    }

    public static void three(int point){
        if(point >= 8){
            three_judge();
            return;
        }
        for(int j=point;j<9;j++){
            three_change(point,j);
            three(point+1);
            three_change(point,j);
        }
    }
    public static void three_change(int n1,int n2){
        double c = 0;
        c = numbers[n1];
        numbers[n1] = numbers[n2];
        numbers[n2] = c;

    }
    public static void three_print(){
        String str = numbers[0]+"+("+numbers[1]+"/"+numbers[2]+")+(("+numbers[3]+""+numbers[4]+" "+numbers[5]+")/("+numbers[6]+" "+numbers[7]+" "+numbers[8]+"))";
        System.out.println(str);
    }
    public  static void three_judge(){
        double a = numbers[0]+(numbers[1]/numbers[2])+((numbers[3]*100+numbers[4]*10+numbers[5])/(numbers[6]*100+numbers[7]*10+numbers[8]));
        if(a == 10.0){
            three_print();
            result++;
        }
    }

    public static void seven() {
        for( loc[0]=1;loc[0]<=8;loc[0]++){
            for( loc[1]=loc[0]+1;loc[1]<=9;loc[1]++){
                for(loc[2]=loc[1]+1;loc[2]<=10;loc[2]++){
                    for( loc[3]=loc[2]+1;loc[3]<=11;loc[3]++){
                        for( loc[4]=loc[3]+1;loc[4]<=12;loc[4]++){
                            seven_judge();
                        }
                    }
                }
            }
        }

    }

    public static void seven_judge(){
        int[] a = new int[]{1,1,1,1,1};
        for(int j=0;j<=4;j++){
            for(int k=j+1;k<=4;k++){
                if(a[j]==0 || a[k]==0){continue;}
                if(seven_judge2(a[j],a[k])){
                    a[j] = 0;
                    a[k] = 0;
                }
            }
        }
        if (seven_judge3(a)) {
            result++;
        }
    }

    public static boolean seven_judge2(int n1,int n2){
        switch (n1) {
            case 1:
                if(n2==5 || n2==2){return true;}
                break;
            case 2:
                if(n2==6 || n2==3 || n2==1){return true;}
                break;
            case 3:
                if(n2==2 || n2==4 || n2==7){return true;}
                break;
            case 4:
                if(n2==8 || n2==3){return true;}
                break;
            case 5:
                if(n2==6 || n2==9 || n2==1){return true;}
                break;
            case 6:
                if(n2==2 || n2==5 || n2==7 || n2==10){return true;}
                break;
            case 7:
                if(n2==3 || n2==6 || n2==8 || n2==11){return true;}
                break;
            case 8:
                if(n2==4 || n2==7 || n2==12){return true;}
                break;
            case 9:
                if(n2==5 || n2==10){return true;}
                break;
            case 10:
                if(n2==6 || n2==9 || n2==11){return true;}
                break;
            case 11:
                if(n2==10 || n2==7 || n2==12){return true;}
                break;
            case 12:
                if(n2==11 || n2==8){return true;}
                break;
        }
        return false;
    }

    public static boolean seven_judge3(int[] a){
        for(int x:a){
            if(x==0){continue;}
            else {return false;}
        }
        return true;
    }

}
